import requests
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey, UniqueConstraint, Index
from sqlalchemy.orm import sessionmaker, relationship, Session
from sqlalchemy import create_engine, Table, MetaData
from sqlalchemy.ext.automap import automap_base
import datetime
import pymysql
from random import choice
# user_info = {'name': 'letian', 'password': '123'}
# r = requests.post("http://127.0.0.1:5000/add", json=user_info)
# print(r.text)
host = "127.0.0.1"
from random import choice
coursename = []
maxpeople = [2,3,4,5,50]
xuefen = [1,2,3]
nian = ['2021','2022','2023']
month = ['1','2','3','4','5','6']
day = ['1','2','3','4','5','6','7','8','9']
xi = ['计算机','自动化','数学']
grade = ['18级','19级','20级']
name = ['郑','开','阳','周','叶','林','月','涛','书']
week = ['1','2','3','4','5','6','7']
keshi = ['1','2','3','4','5','6','7','8']
num = 51
for i in coursename:
    year = choice(nian)
    startdate = year +'-'+choice(month)+'-'+choice(day)
    enddate = year +'-'+choice(month)+'-'+choice(day)
    if startdate>enddate:
        startdate,enddate = enddate,startdate
    realname = choice(name)+choice(name)+choice(name)
    result = 'INSERT  course VALUES ({},\''+i +'\','+str(choice(maxpeople)) + ','+str(choice(xuefen))+',\''+startdate+'\',\'' + enddate+'\',\'A101\',\''+realname+'\',\''+choice(week)+','+choice(keshi)+'\',\''+choice(grade)+'\',\''+choice(xi)+'\');'
    result = result.format(num)
    num+=1
    print(result)
